﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CompilerPrinciples.LexicalAnalysis.DFALexicalAnalysis
{
    public partial class DFA_C_Program :LexicalAnalysis.BaseLexical 
    {
        #region 构造函数
        public DFA_C_Program()
        {
            InitializeComponent();
            
        }
        #endregion 

        #region 调用词法分析的主程序
        /// <summary>
        /// 词法分析的主程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLexicalAnalysis_Click(object sender, EventArgs e)
        {
            CompilerDLL.LexicalAnalysis.DFA_C_Program dfa_C_Program
                = new CompilerDLL.LexicalAnalysis.DFA_C_Program();
            try
            {
                this.AddLexem2DataGridView(dfa_C_Program.LexicalMain(this.txtSourceCode.Text));
            }
            catch(Exception ex)
            {
                MessageBox.Show("错误：" + ex.Message + "请尝试关闭本窗口，并重新执行！", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            
        }
        #endregion 
    }
}
